package cur.tool.common.conifg;

import com.zaxxer.hikari.HikariDataSource;
import cur.nature.tinyorm.core.template.DefaultJdbcTemplate;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DBToolConfig {

	@Bean(name = DefaultJdbcTemplate.DATASOURCE)
    @ConfigurationProperties(prefix = "spring.datasource.hikari")
    public HikariDataSource curDefaultDatasource() {
        HikariDataSource dataSource = new HikariDataSource();
        return dataSource;
    }

    @Bean(name = DefaultJdbcTemplate.TEMPLATE)
    public DefaultJdbcTemplate curDefaultTemplate() {
        return new DefaultJdbcTemplate(curDefaultDatasource());
    }

}